package com.exposit.zbs.entity;

import org.dozer.Mapping;

import javax.persistence.*;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;


@Entity
@Table(name = "grantAreaMoney", catalog = "investfond")

public class GrantAreaMoneyEntity {

	@Mapping("grantAreaMoneyId")
	private Long grantAreaMoneyId;
	@Mapping("grantArea")
	private GrantAreaEntity grantAreaEntity;
	private float moneyAmount;
	@Mapping("user")
	private UserEntity userEntity;
	private Date date;

	public GrantAreaMoneyEntity() {

	}

	@Id
	@GeneratedValue(strategy = IDENTITY)


	@Column(name = "areaMoney_id", unique = true, nullable = false)
	public Long getGrantAreaMoneyId() {

		return this.grantAreaMoneyId;
	}

	public void setGrantAreaMoneyId(Long grantAreaMoneyId) {

		this.grantAreaMoneyId = grantAreaMoneyId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "area_id", nullable = false)
	public GrantAreaEntity getGrantArea() {

		return this.grantAreaEntity;
	}

	public void setGrantArea(GrantAreaEntity grantAreaEntity) {

		this.grantAreaEntity = grantAreaEntity;
	}

	@Column(name = "moneyAmount", nullable = false, precision = 12, scale = 0)
	public float getMoneyAmount() {

		return this.moneyAmount;
	}

	public void setMoneyAmount(float moneyAmount) {

		this.moneyAmount = moneyAmount;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false)
	public UserEntity getUserEntity() {

		return this.userEntity;
	}

	public void setUserEntity(UserEntity userId) {

		this.userEntity = userId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "date", length = 19)
	public Date getDate() {

		return this.date;
	}

	public void setDate(Date date) {

		this.date = date;
	}
}
